package HLCustomUI;

import HLLib.base.HLGraphics;
import HLLib.base.HLGraphics_H;
import HLLib.base.HLInputManager_H;
import HLLib.base.HLMath;
import HLLib.base.HLScreen;
import HLLib.base.HLString;
import HLLib.control.HLControl_H;
import HLLib.control.HLTextPage;

public class HLListBoxItemMessage extends HLIListItem implements HLControl_H, HLInputManager_H, HLGraphics_H {

    public HLTextPage textPage;

    public void SetText(HLString text) {
        textPage = new HLTextPage();
        int screenWidth = HLScreen.Width();
        int width = HLMath.Subtract(screenWidth, 32);
        textPage.SetSize(width, 30);
        textPage.SettingNormal(-1, 1, 1, 0, 0xff000000, 0, TEXT_STYLE_NORMAL, LEFT_VCENTER, FONT_SIZE_SMALL);
        textPage.SetText(text);
        textPage.AdjustToAllTextHeight();
    }

    public void Render(HLGraphics g, int rectX, int rectY, int rectWidth, int rectHeight, boolean selected) {
        textPage.Render(g, rectX, rectY);
        if (selected) {
            g.DrawRectRim(rectX, rectY, rectWidth, rectHeight, 1, 0xff00ff00);
        }

    }

    public int GetItemHeight() {
        return textPage.height;
    }

    public HLString GetName() {
        return null;
    }
}
